<div class="da-list-wrap">
  <div class="da-content-banner">
    <d-breadcrumb>
      <d-breadcrumb-item><a routerLink="/">{{ 'inventory.breadcrumb.home' | translate }}</a></d-breadcrumb-item>
      <d-breadcrumb-item><a routerLink="/pages/inventory/initial-inventory">{{ 'inventory.breadcrumb.InitialInventory' | translate }}</a></d-breadcrumb-item>
      <d-breadcrumb-item>{{ 'inventory.breadcrumb.addInitialInventory' | translate }}</d-breadcrumb-item>
    </d-breadcrumb>
  </div>
  <div class="da-content-wrapper">

        <div class="da-form-container ">
            <div class="card">
              <div class="card-title">
                <p class="form-title">其他入库单——制单</p>
              </div>
              <form dForm ngForm [layout]="layoutDirection" [labelSize]="'sm'"[labelAlign]="'end'" class="mt-5" (dSubmit)="submit()">
                <div class="form-body">
                  <div>
                    <h4>基础信息</h4>
                  </div>
                  <div class="grid mt-3">
                    <div class="u-1-2">
                      <d-form-item>
                        <d-form-label>
                          <span class="label"><span class="Required">*</span>单据编码</span>
                        </d-form-label>
                        <d-form-control>
                          <input dTextInput class="form-input-box" name="单据编码" [(ngModel)]="InitialInventory.otherWarehousingNum">
                        </d-form-control>
                      </d-form-item>
                    </div>
                    <div class="u-1-2">
                      <d-form-item>
                        <d-form-label>
                          <span class="label"><span class="Required">*</span>单据日期</span>
                        </d-form-label>
                        <d-form-control>
                          <d-datepicker-pro [appendToBody]="false" [(ngModel)]="InitialInventory.dateTime" name="单据日期"></d-datepicker-pro>
                        </d-form-control>
                      </d-form-item>
                    </div>
                    <div class="u-1-2">
                      <d-form-item>
                        <d-form-label>
                          <span class="label"><span class="Required">*</span>制单人</span>
                        </d-form-label>
                        <d-form-control>
                          <input dTextInput class="form-input-box" name="制单人" [(ngModel)]="InitialInventory.createUser"  readonly>
                        </d-form-control>
                      </d-form-item>
                    </div>
                    <div class="u-1-2">
                      <d-form-item>
                        <d-form-label>
                          <span class="label">制单日期</span>
                        </d-form-label>
                        <d-form-control>
                          <d-datepicker-pro [appendToBody]="false" [disabled]="true" [(ngModel)]="InitialInventory.createTime" name="制单日期"></d-datepicker-pro>
                        </d-form-control>
                      </d-form-item>
                    </div>
                    <div class="u-1">
                      <d-form-item>
                        <d-form-label>
                          <span class="label">备注</span>
                        </d-form-label>
                        <d-form-control>
                          <textarea dTextarea class="textarea"  name="description" [(ngModel)]="InitialInventory.note"></textarea>
                        </d-form-control>
                      </d-form-item>
                    </div>
                  </div>
                  <div>
                    <h4>物料信息</h4>
                  </div>
                  <div class="table">
                    <d-data-table  [dataSource]="tableData"
                        [scrollable]="true" [fixHeader]="true"
                        [tableWidthConfig]="tableWidthConfig" >
                        <thead dTableHead>
                          <tr dTableRow>
                            <th dHeadCell>&nbsp; </th>
                            <th dHeadCell *ngFor="let colOption of dataTableOptions.columns">{{ colOption.header }}</th>
                          </tr>
                        </thead>
                        <tbody dTableBody >
                          <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex">
                            <tr dTableRow>
                              <td dTableCell>
                                <span (click)="add()"><i class="icon-code-editor-add add" ></i></span>
                                <span class="ms-3" (click)="remove(rowIndex)"><i class="icon-code-editor-less minus" style="font-size: 16px;"></i></span>
                              </td>
                              <td dTableCell >
                                <input type="text" dTextInput style="width: 80%;" (click)="selectMaterial(rowIndex)" readonly [(ngModel)]="rowItem.partNum" [ngModelOptions]="{standalone: true}">
                              </td>
                              <td dTableCell >
                                <span class="ellipsis" dTooltip [content]="rowItem?.partName">{{rowItem.partName}}</span>
                              </td>
                              <td dTableCell >
                                <span class="ellipsis" dTooltip [content]="rowItem?.partType">{{rowItem.partType}}</span>
                              </td>
                              <td dTableCell >
                                <span class="ellipsis" dTooltip [content]="rowItem?.partUOM">{{rowItem.partUOM}}</span>
                              </td>
                              <td dTableCell >
                                <input type="number" dTextInput style="width: 80%;"   [(ngModel)]="rowItem.receiptQuantity" [ngModelOptions]="{standalone: true}">
                              </td>
                              <td dTableCell >
                                <input type="text" dTextInput style="width: 80%;" (click)="selectWarehouse(rowIndex)" readonly [(ngModel)]="rowItem.warehouseName" [ngModelOptions]="{standalone: true}">
                              </td>
                              <td dTableCell >
                                <input type="text" dTextInput style="width: 80%;" (click)="SelectPosition(rowIndex)" readonly [(ngModel)]="rowItem.positionName" [ngModelOptions]="{standalone: true}">
                              </td>
                              <td dTableCell >
                                <span class="ellipsis"> <input type="text" dTextInput style="width: 80%;"  [(ngModel)]="rowItem.remake" [ngModelOptions]="{standalone: true}"></span>
                              </td>
                            </tr>
                          </ng-template>
                    </d-data-table>
                  </div>
                </div>
                <d-form-operation>
                  <d-button bsStyle="primary" dFormSubmit >确定</d-button>
                  <d-button class="ms-3" bsStyle="common" (btnClick)="cancle()">取消</d-button>
                </d-form-operation>
              </form>
            </div>
        </div>

  </div>
</div>

<d-toast [value]="msgs" [life]="2000" [styleClass]="'custom-class'" [style]="{ left: '50%',top:'10px' }"></d-toast>
